package au.com.georgi.wave.parser;

import java.util.logging.Logger;

import au.com.georgi.wave.matcher.PatternMatcher;

public class PortraitParser implements Parser {

	private static final Logger log = Logger.getLogger(PortraitParser.class
			.getName());
	private final String rawWebsite;

	public PortraitParser(String rawWebsite) {
		this.rawWebsite = rawWebsite;
	}

	public String parseSource() {
		log.warning("Beginning parse of source... ");

		StringBuilder portraitURL = new StringBuilder(
				"http://www.wowarmory.com/");
		String result = PatternMatcher.getURL("_images/portraits/(.+).gif",
				rawWebsite);
		if (result != null)
			portraitURL.append(result);
		else
			return null;

		log.warning("Portrait URL found: " + portraitURL);

		return portraitURL.toString();
	}
}
